﻿namespace Eldert.BTUG.IoT.Device.RaspberryPi2
{
    // ReSharper disable NotAccessedField.Local
    using Windows.ApplicationModel.Background;

    /// <summary>
    /// The startup task for the IoT application.
    /// </summary>
    public sealed class StartupTask : IBackgroundTask
    {
        /// <summary>
        /// The deferral used to keep the application running in the background.
        /// </summary>
        private BackgroundTaskDeferral _deferral;

        /// <summary>
        /// The method called when starting the application.
        /// </summary>
        /// <param name="taskInstance">
        /// The task instance.
        /// </param>
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            _deferral = taskInstance.GetDeferral();
            ProcessEngineReadings.Send();
            SettingsManagement.CheckForUpdatedSettings();
        }
    }
}